package com.youku.collector;

import java.io.File;
import java.io.FileFilter;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * 单消费者，单生产者：2553ms
 * 
 * @author loda
 *
 */
public class Controller {

	public static void main(String[] args) {

		BlockingQueue<Record> queue = new LinkedBlockingQueue<>();

		new ProducerController(new Producer(queue, new File("/data/monitor/statistics"), new FileFilter() {

			@Override
			public boolean accept(File pathname) {
				return true;
			}
		})).start();

		new ConsumerController(new Consumer(queue), 15).start();

		try {
			new CountDownLatch(1).await();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
